﻿/******************************************
* 模块名称：实体 角色表_base
* 当前版本：1.0
* 开发人员：Administrator
* 生成时间：2013-03-13
* 版本历史：此代码由 VB/C#.Net实体代码生成工具(EntitysCodeGenerate 4.3) 自动生成。
* 
******************************************/
using System;
using System.Data;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Xml;
using System.IO;
using System.Text;
using System.Database;
using System.Database.ORMap;
using System.Database.Extend;

namespace OAKing.Entity.Common
{
	/// <summary>
	/// 实体 角色表_base
	/// </summary>
	[Serializable(),Description("Primary:RoleID")]
	public partial class B_Role : BaseEntity
	{
        #region 构造函数
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        public B_Role(){}
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        /// <param name="keyValue">主键RoleID对应的值</param>
        public B_Role(object keyValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add("RoleID", keyValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(list);
        }
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名(colName)匹配相等的值</param>
        public B_Role(string colName, object colValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add(colName, colValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(list);
        }
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组(colNames)匹配相等的值</param>
        public B_Role(string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary list = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    list.Add(colNames[i], colValues[i]);
                }
                ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
                ormap.GetEntity(list);
            }
        }
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名(colName)匹配相等的值</param>
        public B_Role(DbCore dbCore, string colName, object colValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add(colName, colValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(dbCore, list);
        }
        /// <summary>
        /// 实体 角色表_base
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组(colNames)匹配相等的值</param>
        public B_Role(DbCore dbCore, string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary list = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    list.Add(colNames[i], colValues[i]);
                }
                ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
                ormap.GetEntity(dbCore, list);
            }
        }
        #endregion

        #region 私有变量
        private Int32 _roleid = Int32.MinValue;
        private string _rolename = null;
        private string _roledesc = null;
        private Int32 _createid = Int32.MinValue;
        private string _createname = null;
        private DateTime _createtime = DateTime.MinValue;
        private Int32 _isused = Int32.MinValue;
        #endregion

        #region 公共属性
        /// <summary>
        /// 主键 角色ID(NOT NULL)
        /// </summary>
        [DataObjectField(true)]
        public Int32 RoleID
        {
            set{ _roleid=value;}
            get{return _roleid;}
        }
        /// <summary>
        /// 角色名称(NOT NULL)
        /// </summary>
        [DataObjectField(false)]
        public string RoleName
        {
            set{ _rolename=value;}
            get{return _rolename;}
        }
        /// <summary>
        /// 角色描述
        /// </summary>
        [DataObjectField(false)]
        public string RoleDesc
        {
            set{ _roledesc=value;}
            get{return _roledesc;}
        }
        /// <summary>
        /// 创建人
        /// </summary>
        [DataObjectField(false)]
        public Int32 CreateID
        {
            set{ _createid=value;}
            get{return _createid;}
        }
        /// <summary>
        /// 创建人账户
        /// </summary>
        [DataObjectField(false)]
        public string CreateName
        {
            set{ _createname=value;}
            get{return _createname;}
        }
        /// <summary>
        /// 创建时间
        /// </summary>
        [DataObjectField(false)]
        public DateTime CreateTime
        {
            set{ _createtime=value;}
            get{return _createtime;}
        }
        /// <summary>
        /// 是否启用
        /// </summary>
        [DataObjectField(false)]
        public Int32 IsUsed
        {
            set{ _isused=value;}
            get{return _isused;}
        }
        #endregion

        #region 常用 增、删、改、查 操作(注：.Net下数值型字段初始值默认为0;带?的数值型字段值默认为null.)

        #region public override int DelInsert/DelInsertEx 扩展方法
        /// <summary>
        ///  先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public override int DelInsert()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.DelInsert(new B_Role());
        }
        /// <summary>
        /// 先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public override int DelInsertEx()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.DelInsertEx(new B_Role());
        }
        #endregion

        #region public override int Insert 增加
        /// <summary>
        /// 通过实体映射插入表中一条数据，插入与初始值不同的字段
        /// </summary>
        /// <returns>执行插入数据并返回受影响的行数</returns>
        public override int Insert()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Insert(new B_Role());
        }
        #endregion

        #region public override int Update 更新
        /// <summary>
        /// 通过实体映射及主键约束更新表中一条数据，并与比较实体初始值比较，若内容不同则更新之，否则不更新(并与实体默认初始值比较确定更新哪些字段,与默认初始值一样的字段将不更新)
        /// </summary>
        /// <returns>执行更新并返回受影响的行数</returns>
        public override int Update()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Update(new B_Role());
        }
        #endregion

        #region public override int Save 保存 规则：按主键判断有就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// <summary>
        /// 保存 比较实体前后的值，若有与主键记录相同的就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// </summary>
        /// <returns>执行更新或插入数据操作并返回受影响的行数</returns>
        public override int Save()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Save1(new B_Role());
        }
        #endregion

        #region public B_Role GetEntity 获取实体信息
        /// <summary>
        /// 通过实体映射及主键值获取表中一条数据信息
        /// </summary>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public B_Role GetEntity()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.GetEntity() as B_Role;
        }
        /// <summary>
        /// 通过实体映射及主键值获取表中一条数据信息
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public B_Role GetEntity(DbCore dbCore)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.GetEntity(dbCore) as B_Role;
        }
        /// <summary>
        /// 通过Hashtable键值实体条件获取表中一条数据信息
        /// </summary>
        /// <param name="hash">获取实体信息的条件值</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public B_Role GetEntity(Hashtable hash)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(new B_Role(), new B_Role());
            return ormap.GetEntity(hash) as B_Role;
        }
        /// <summary>
        /// 根据ListDictitionary键值实体条件值获取实体信息,通常包含 10 个或 10 个以下项的集合,建议这时使用
        /// </summary>
        /// <param name="list">获取实体信息的条件值</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public B_Role GetEntity(ListDictionary list)
        {;
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(new B_Role(), new B_Role());
            return ormap.GetEntity(list) as B_Role;
        }
        #endregion

        #region public int SaveByEntityCondition 保存 规则：按当前实体唯一条件值判断有就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// <summary>
        /// 用于没有主键表的辅助方法，有主键表的建议使用Save()
        /// 保存 比较实体前后的值，若有与现在实体唯一记录相同的就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// 前提条件当前实体字段所赋值必须唯一，否则获取记录为多条返回多条更新将会产生不正确的结果，更新多条记录等问题
        /// </summary>
        /// <param name="entityCondition">更新或插入的实体唯一条件</param>
        /// <returns>执行更新或插入数据操作并返回受影响的行数</returns>
        public int SaveByEntityCondition(B_Role entityCondition)
        {
            B_Role entity = new B_Role();
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, entity);
            return ormap.SaveByAny(entity, entityCondition);
        }
        #endregion

        #region public B_Role GetEntityByEntityCondition 通过实体值获取一条实体信息
        /// <summary>
        /// 用于没有主键表的辅助方法，有主键表的建议使用GetEntity()
        /// 通过实体信息并与实体初始值的比较，凡与初始值比较不同的值作为实体的获取条件，返回相应的一条实体信息
        /// </summary>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条),没有返回为null</returns>
        public B_Role GetEntityByEntityCondition()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.GetEntityByAny() as B_Role;
        }
        #endregion

        #endregion

        #region public B_Role FromXml 相关Xml操作
        /// <summary>
        /// 通过与持久化实体信息相对应Xml格式的文本信息实例化到该实体信息
        /// </summary>
        /// <param name="xmlString">与持久化实体信息相对应Xml格式的文本信息</param>
        /// <returns>返回对应的实体信息</returns>
        public B_Role FromXml(string xmlString)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.FromXml(xmlString) as B_Role;
        }
        /// <summary>
        /// 通过与持久化实体信息相对应Xml格式的文本信息实例化到该实体信息
        /// </summary>
        /// <param name="filename">文件的 URL，该文件包含要加载的 XML 文档。URL 既可以是本地文件，也可以是 HTTP URL（Web 地址）。</param>
        /// <returns>实例化该实体信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public B_Role FromXmlFile(string filename)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.FromXmlFile(filename) as B_Role;
        }
        #endregion

        #region public B_Role FromString 通过与持久化实体信息相对应的字符串拼接文本信息实例化到该实体信息
        /// <summary>
        /// 通过与持久化实体信息相对应的字符串拼接文本信息实例化到该实体信息
        /// </summary>
        /// <param name="entityString">与持久化实体信息相对应的字符串拼接文本信息</param>
        /// <returns>返回对应的实体信息</returns>
        public B_Role FromString(string entityString)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.FromEntityString(entityString) as B_Role;
        }
        #endregion

        #region public B_Role FromJSON 通过与持久化实体信息相对应的JSON格式信息实例化到该实体信息
        /// <summary>
        /// 通过与持久化实体信息相对应的JSON格式信息实例化到该实体信息
        /// </summary>
        /// <param name="jsonString">JSON格式的实体信息</param>
        /// <returns>返回实例化后的实体信息并与JSON格式信息保持一致</returns>
        public B_Role FromJSON(string jsonString)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.FromJSON(jsonString) as B_Role;
        }
        #endregion

        #region public B_Role FromDataRow 通过与实体信息相对应的 DataRow 实例化到实体信息
        /// <summary>
        /// 通过与实体信息相对应的 DataRow 实例化到实体信息
        /// </summary>
        /// <param name="dr">与实体信息相对应的 DataRow</param>
        /// <returns>返回实例化后的实体信息并与 DataRow 信息一致</returns>
        public B_Role FromDataRow(DataRow dr)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new B_Role());
            return ormap.FromDataRow(dr) as B_Role;
        }
        #endregion

        #region 公共静态只读属性
        /// <summary>
        /// 表名 表原信息描述: 角色表_base
        /// </summary>
        public static readonly string s_TableName="B_Role";
        /// <summary>
        /// 信息描述: 角色ID(NOT NULL)
        /// </summary>
        public static readonly string s_RoleID="B_Role┋RoleID┋System.Int32";
        /// <summary>
        /// 信息描述: 角色名称(NOT NULL)
        /// </summary>
        public static readonly string s_RoleName="B_Role┋RoleName┋System.String";
        /// <summary>
        /// 信息描述: 角色描述
        /// </summary>
        public static readonly string s_RoleDesc="B_Role┋RoleDesc┋System.String";
        /// <summary>
        /// 信息描述: 创建人
        /// </summary>
        public static readonly string s_CreateID="B_Role┋CreateID┋System.Int32";
        /// <summary>
        /// 信息描述: 创建人账户
        /// </summary>
        public static readonly string s_CreateName="B_Role┋CreateName┋System.String";
        /// <summary>
        /// 信息描述: 创建时间
        /// </summary>
        public static readonly string s_CreateTime="B_Role┋CreateTime┋System.DateTime";
        /// <summary>
        /// 信息描述: 是否启用
        /// </summary>
        public static readonly string s_IsUsed="B_Role┋IsUsed┋System.Int32";
        #endregion
	}

    /// <summary>
    /// 角色表_base实体集
    /// </summary>
    [Serializable]
    public class B_RoleS : CollectionBase
    {
        #region 构造函数
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        public B_RoleS(){}
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="blnRetrieveData">是否获取所有数据到实体集对象的标示(true获取所有实例信息,false仅实例化对象)</param>
        public B_RoleS(bool blnRetrieveData)
        {
            if (blnRetrieveData)
            {
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(new ListDictionary());
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="blnRetrieveData">是否获取所有数据到实体集对象的标示(true获取所有实例信息,false及实例化对象)</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(bool blnRetrieveData, string[] orderColumns, OrderDirection[] orderDirections)
        {
            if (blnRetrieveData)
            {
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(new ListDictionary(), new Operation[] { }, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名匹配相等的值</param>
        public B_RoleS(string colName,object colValue)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(),this);
            ormaps.GetEntitys(listColAndValue);
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        public B_RoleS(string colName, Operation operate,object colValue)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(),this);
            ormaps.GetEntitys(listColAndValue, operate);
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        /// <param name="orderColumn">排序字段</param>
        /// <param name="orderDirection">对应排序方向</param>
        public B_RoleS(string colName, Operation operate, object colValue, string orderColumn, OrderDirection orderDirection)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            ormaps.GetEntitys(listColAndValue, new Operation[] { operate }, new string[] { orderColumn }, new OrderDirection[] { orderDirection });
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(string colName, Operation operate, object colValue, string[] orderColumns, OrderDirection[] orderDirections)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            ormaps.GetEntitys(listColAndValue, new Operation[] { operate }, orderColumns, orderDirections);
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组匹配相等的值</param>
        public B_RoleS(string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(listColAndValue);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">比较操作符数组</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        public B_RoleS(string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">比较操作符数组</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns, OrderDirection[] orderDirections)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配相等的值</param>
        public B_RoleS(ListDictionary listColAndValue)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            ormaps.GetEntitys(listColAndValue);
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        public B_RoleS(ListDictionary listColAndValue, Operation[] operates)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(listColAndValue, operates);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(ListDictionary listColAndValue, Operation[] operates, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="orderColumn">排序字段</param>
        /// <param name="orderDirection">排序方向</param>
        public B_RoleS(string orderColumn,OrderDirection orderDirection)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            ormaps.GetEntitys(new ListDictionary(), new Operation[] { }, new string[] { orderColumn }, new OrderDirection[] { orderDirection });
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(string[] orderColumns,OrderDirection[] orderDirections)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            ormaps.GetEntitys(new ListDictionary(), new Operation[] { }, orderColumns, orderDirections);
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(DbCore dbCore, ListDictionary listColAndValue, Operation[] operates, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(dbCore, listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// 角色表_base实体集
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public B_RoleS(DbCore dbCore, string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
                ormaps.GetEntitys(dbCore, listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        #endregion

        #region 属性方法
        /// <summary>
        /// 角色表_base集合 增加方法
        /// </summary>
        public void Add(B_Role entity)
        {
            this.List.Add(entity);
        }
        /// <summary>
        /// 角色表_base集合 索引
        /// </summary>
        public B_Role this[int index]
        {
            get { return (B_Role)this.List[index]; }
            set { this.List[index] = value; }
        }
        /// <summary>
        /// 将角色表_base实体集转化到内存中一个数据表
        /// </summary>
        /// <returns>与实体集数据对等的内存中一个数据表</returns>
        public DataTable ToDataTable()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.ToDataTable();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值(并与实体默认初始值比较确定保存哪些字段)，若有与主键记录相同的就更新，没有就插入
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int Save()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.Save();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值，若有与主键字段记录相同的就更新，没有就插入，保存全部字段
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int SaveAll()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.SaveAll();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值，若有与主键字段记录相同的就更新，没有就插入，保存全部字段
        /// 其中若与实体属性字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int SaveEx()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.SaveEx();
        }
        /// <summary>
        /// 通过实体集中的对象信息映射及主键约束批量删除实体集对应表中的多条数据
        /// </summary>
        /// <returns>执行删除并返回受影响的行数</returns>
        public int Delete()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.Delete();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsert();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert(string strConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsert(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsert(arrConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertEx();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx(string strConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertEx(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertEx(arrConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll()
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertAll();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll(string strConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertAll(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, B_RoleS> ormaps = new ORMaps<BaseEntity, B_RoleS>(new B_Role(), this);
            return ormaps.DelInsertAll(arrConditionKey);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(不含DataType属性)
        /// </summary>
        /// <returns>与持久化实体集信息相对应Xml的文本信息</returns>
        public string ToXml()
        {
            return this.ToXml(Formatting.None);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(不含DataType属性)
        /// </summary>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        /// <returns>与持久化实体集信息相对应Xml指定格式化后的文本信息(不含DataType属性)</returns>
        public string ToXml(Formatting xmlFormatting)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string strName = "B_RoleS";
            sb.AppendLine("<" + strName + ">");
            foreach (B_Role e in this)
            {
                sb.AppendLine(e.ToXml(xmlFormatting));
            }
            sb.AppendLine("</" + strName + ">");
            return sb.ToString();
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式信息并写入到文件(不含DataType属性)
        /// </summary>
        /// <param name="filename">要写入的文件名。如果目标文件已存在，则覆盖该文件。</param>
        /// <param name="encoding">一个 System.Text.Encoding 对象，表示应用于字符串的编码。</param>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        public void ToXml(string filename, Encoding encoding, Formatting xmlFormatting)
        {
            string xmlString = this.ToXml(xmlFormatting);
            File.WriteAllText(filename, xmlString, encoding);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(含DataType属性)
        /// </summary>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        /// <returns>与持久化实体集信息相对应Xml指定格式化后的文本信息</returns>
        public string ToXml_(Formatting xmlFormatting)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string strName = "B_RoleS";
            sb.AppendLine("<" + strName + ">");
            foreach (B_Role e in this)
            {
                sb.AppendLine(e.ToXml_(xmlFormatting));
            }
            sb.AppendLine("</" + strName + ">");
            return sb.ToString();
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式信息并写入到文件(含DataType属性)
        /// </summary>
        /// <param name="filename">要写入的文件名。如果目标文件已存在，则覆盖该文件。</param>
        /// <param name="encoding">一个 System.Text.Encoding 对象，表示应用于字符串的编码。</param>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        public void ToXml_(string filename, Encoding encoding, Formatting xmlFormatting)
        {
            string xmlString = this.ToXml_(xmlFormatting);
            File.WriteAllText(filename, xmlString, encoding);
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="xmlString"></param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public B_RoleS FromXml(string xmlString)
        {
            int index = 0;
            string strSubXml = string.Empty;
            this.Clear();
            while (index != -1) 
            {
                index = CommonHelp.GetSubXmlString(xmlString, "B_Role", index, out strSubXml);
                if (strSubXml != string.Empty)
                {
                    B_Role entity = new B_Role();
                    entity = entity.FromXml(strSubXml);
                    this.Add(entity);
                }
                else
                {
                    break;
                }
            }
            return this;
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="filename">要打开以进行读取的文件</param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public B_RoleS FromXmlFile(string filename)
        {
            string xmlString = File.ReadAllText(filename);
            return this.FromXml(xmlString);
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="filename">要打开以进行读取的文件</param>
        /// <param name="encoding">应用到文件内容的编码。</param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public B_RoleS FromXmlFile(string filename, Encoding encoding)
        {
            string xmlString = File.ReadAllText(filename, encoding);
            return this.FromXml(xmlString);
        }
        /// <summary>
        /// 将持久化实体集信息输出成JSON格式信息
        /// </summary>
        /// <returns>与持久化实体集信息相同的JSON格式信息</returns>
        public string ToJSON()
        {
            StringBuilder sb = new StringBuilder();
            foreach (B_Role e in this)
            {
                sb.AppendLine(e.ToJSON() + ",");
            }
            return "[" + sb.ToString().TrimEnd(new char[] { '\n', '\r', ',' }) + "]";
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应的JSON格式信息实例化到该实体集信息
        /// </summary>
        /// <param name="jsonString">JSON格式的实体集信息</param>
        /// <returns>返回实例化后的实体集信息并与JSON格式信息保持一致</returns>
        public B_RoleS FromJSON(string jsonString)
        {
            string[] arrayJson = jsonString.Trim(new char[] { '\n', '\r', ' ' }).TrimStart('[').TrimEnd(']').Replace("}\r\n,", "},").Split(new string[] { "}," }, StringSplitOptions.RemoveEmptyEntries);
            this.Clear();
            foreach(string str in arrayJson)
            {
                B_Role entity = new B_Role();
                entity = entity.FromJSON(str);
                this.Add(entity);
            }
            return this;
        }
        /// <summary>
        /// 将持久化实体集信息输出成String格式信息
        /// </summary>
        /// <returns>与实体集信息相同的String格式信息</returns>
        public override string ToString()
        {
            string strEntitys = String.Empty;
            foreach (B_Role e in this)
            {
                strEntitys += e.ToString() + "┋┋";
            }
            return strEntitys.TrimEnd('┋');
        }
        /// <summary>
        /// 通过与实体集信息相对应的String格式信息实例化到该实体集信息
        /// </summary>
        /// <param name="entitysString">与实体集信息相同的String格式信息</param>
        /// <returns>返回实例化后的实体集信息并与String格式信息保持一致</returns>
        public B_RoleS FromString(string entitysString)
        {
            this.Clear();
            string[] arrayString = entitysString.Split(new string[] { "┋┋" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string str in arrayString)
            {
                B_Role entity = new B_Role();
                entity = entity.FromString(str);
                this.Add(entity);
            }
            return this;
        }
        /// <summary>
        /// 通过与实体集信息相对应的 DataTable 实例化到实体集信息
        /// </summary>
        /// <param name="dtbl">与实体集信息相同的 DataTable 信息</param>
        /// <returns>返回实例化后的实体集信息并与 DataTable 信息一致</returns>
        public B_RoleS FromDataTable(DataTable dtbl)
        {
            this.Clear();
            foreach (DataRow dr in dtbl.Rows)
            {
                B_Role entity = new B_Role();
                entity = entity.FromDataRow(dr);
                this.Add(entity);
            }
            return this;
        }
        #endregion
    }

	/// <summary>
	/// 实体原表描述信息:角色表_base
	/// </summary>
	public class B_RoleColumn
	{
        #region 公共静态只读属性
        /// <summary>
        /// 表名 表原信息描述: 角色表_base
        /// </summary>
        public static readonly string TableName="B_Role";
        /// <summary>
        /// 信息描述: 角色ID(NOT NULL)
        /// </summary>
        public static readonly string RoleID="B_Role┋RoleID┋System.Int32";
        /// <summary>
        /// 信息描述: 角色名称(NOT NULL)
        /// </summary>
        public static readonly string RoleName="B_Role┋RoleName┋System.String";
        /// <summary>
        /// 信息描述: 角色描述
        /// </summary>
        public static readonly string RoleDesc="B_Role┋RoleDesc┋System.String";
        /// <summary>
        /// 信息描述: 创建人
        /// </summary>
        public static readonly string CreateID="B_Role┋CreateID┋System.Int32";
        /// <summary>
        /// 信息描述: 创建人账户
        /// </summary>
        public static readonly string CreateName="B_Role┋CreateName┋System.String";
        /// <summary>
        /// 信息描述: 创建时间
        /// </summary>
        public static readonly string CreateTime="B_Role┋CreateTime┋System.DateTime";
        /// <summary>
        /// 信息描述: 是否启用
        /// </summary>
        public static readonly string IsUsed="B_Role┋IsUsed┋System.Int32";
        #endregion
	}
}
